#include "flash_blob.h"

static const uint32_t flash_code[] =
{
    0XE00ABE00,0X062D780D,0X24084068,0XD3000040,0X1E644058,0X1C49D1FA,0X2A001E52,0X4770D1F2,
    0X2100484B,0X494B6001,0X4A4B6041,0X60816042,0X69C06082,0XD4080740,0XF2454848,0X60015155,
    0X60412106,0X71FFF640,0X20006081,0X48404770,0XF0416901,0X61010180,0XF4216901,0X61017100,
    0X47702000,0XB510483A,0XF0416901,0X61010120,0XF0416901,0X61010140,0X22AAF64A,0XE0004937,
    0X68C3600A,0XD1FB07DB,0XF0236903,0X61030320,0XF0436903,0X61030310,0XF6454C31,0X802323A5,
    0X600AE000,0X07DB68C3,0X6901D1FB,0X0110F021,0X68C16101,0X0F14F011,0X68C1D005,0X0114F041,
    0X200160C1,0X2000BD10,0X4821BD10,0XF0416901,0X61010120,0XF0416901,0X61010140,0X21AAF64A,
    0XE0004A1E,0X68C36011,0XD1FB07DB,0XF0216901,0X61010120,0X47702000,0X47702001,0X1C49B570,
    0X0101F021,0XF64A4D12,0X4C1423AA,0X692EE01B,0X0610F046,0X8816612E,0XE0008006,0X68EE6023,
    0XD1FB07F6,0XF026692E,0X612E0610,0XF01668EE,0XD0050F14,0XF04068E8,0X60E80014,0XBD702001,
    0X1C921C80,0X29001E89,0X2000D1E1,0X0000BD70,0X40022000,0X45670123,0XCDEF89AB,0X40003000,
    0X1FFFF800,0X00000000,0X00000000,
};

const program_target_t flash_algo_GD32F10X =
{
    0X20000021,  // Init
    0X2000004F,  // UnInit
    0X20000065,  // EraseChip
    0X200000CB,  // EraseSector
    0X200000FD,  // ProgramPage

    // BKPT : start of blob + 1
    // RSB  : address to access global/static data
    // RSP  : stack pointer
    {
        0X20000001,
        0X20000C00,
        0X20001000,
    },

    0x20000400,                      // mem buffer location
    0x20000000,                      // location to write prog_blob in target RAM
    sizeof(flash_code),              // prog_blob size
    flash_code,                      // address of prog_blob
    0x00000400,                      // ram_to_flash_bytes_to_be_written
};
